import { configureStore } from '@reduxjs/toolkit';
import loginStore from '@/store/modules/loginStore';
import userStore from '@/store/modules/userStore';
import homeStore from '@/store/modules/homeStore';
import patientStore from '@/store/modules/patientStore';
import addressStore from '@/store/modules/addressStore';
import consultStore from '@/store/modules/consultStore';
import departmentStore from '@/store/modules/departmentStore';

const store = configureStore({
  reducer: {
    loginStore,
    userStore,
    homeStore,
    patientStore,
    addressStore,
    consultStore,
    departmentStore,
  },
});


// 从store本身推断出' RootState '和' AppDispatch '类型
export type RootState = ReturnType<typeof store.getState>

// 推断类型 type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch

export default store;